package MyQueue;
import MyLinkedList.MyLinkedList;

public class MyLinkedQueue<T> {
    private MyLinkedList<T> list;
    public MyLinkedQueue() {
        this.list = new MyLinkedList<T>();
    }
    public int size() {
        return this.list.size();
    }
    public void offer(T o) {
        list.addLast(o);
    }
    public T poll() {
        Object value = this.list.get(0);
        this.list.remove(0);
        return (T)value;
    }
    public void clear() {
        int size = this.size();
        for(int i = 0; i < size; i++) {
            this.poll();
        }
    }
    public boolean isEmpty() {
        return this.list.isEmpty();
    }
    @Override
    public String toString() {
        return this.list.toString();
    }
}
